<template>
    <div class="express-spot">
        <div>
            <map-site-preview :polygonObj="polygonObj" :show-button="showButton"></map-site-preview>
        </div>
        <div class="express-spot-table">
            <lar-table :model="model" canAdd="canAdd"></lar-table>
        </div>

    </div>
</template>

<script>
    import MapSitePreview from '../../../components/map/map-site'
    export default {
        name: "site",
        components: {
            MapSitePreview
        },
        data() {
            return {
                api: 'express/spot?pageSize=100&size=1',
                polygonObj: [],
                showButton: true,
                model: 'express.spot'
            }
        },
        created() {
            this.getSite()
        },
        methods: {
            getSite(value) {
                this.$http.get(this.api)
                    .then((response) => {
                        this.polygonObj = response.data.data;
                        // console.info('数据返回的值', this.polygonObj);
                    })
                    .catch((error) => {
                        if(error.response.data.msg){
                            this.$message.error(error.response.data.msg);
                        }else{
                            this.$message.error('请求错误：'+error.response.status);
                        }
                    });
            }
        }

    }
</script>

<style scoped lang="less">
    .express-spot{
        .express-spot-table{
            background-color: #fff;
            padding: 20px 16px;
            margin: 0 0px 0 10px;
        }
    }
</style>
